package org.moonlight.jvm.natives.java.lang.object;

import org.moonlight.jvm.natives.AbstractNativeMethod;
import org.moonlight.jvm.rtda.exclusive.Frame;
import org.moonlight.jvm.rtda.share.Object;

/**
 * 本地方法 hashCode()
 *
 * @author Moonlight
 * @createTime 2023/9/20 17:52
 **/
public class HashCode extends AbstractNativeMethod {

    public HashCode() {
        super(JAVA_LANG_OBJECT, "hashCode", "()I");
    }

    @Override
    public void nativeMethod(Frame frame) {
        Object that = frame.getLocalVars().getThis();
        int hashCode = that.hashCode();
        frame.getOperandStack().pushInt(hashCode);
    }

}
